extends layout

block content
  -var imagelikes = likes ? likes : 0
  .row
    .col-12.col-md-8
      .card
        img.card-img-top(src=`/uploads/${diskfilename}`, alt=title)
        .card-body.d-flex.justify-content-between
          div.inline-block
            span= title
            span= ' '
            span= ' 上传者: '
            span= uploader.nickname
          div.inline-block
            i.fa.fa-heart
            span#likes= imagelikes
            span 个赞
          button.btn.btn-primary#likes-btn(data-imageid=_id)
            i.fa.fa-heart-o
            | 赞
      .list-group.mt-1
        each comment in comments
          li.list-group-item
            p= comment.comment
            p= comment.nickname
            p= comment.email
    .col-12.col-md-4
      include includes/stats.pug
  .row
    .col-12.col-md-8
      .card
        .card-body
          h4.card-title 发表评论
          form(action=`/comments/${_id}`, method="post")
            .form-group.row
              label.col-12.col-md-2 邮箱
              input.col-12.col-md-10.form-control(type="email", name="email")
            .form-group.row
              label.col-12.col-md-2 昵称
              input.col-12.col-md-10.form-control(type="text", name="nickname")
            .form-group.row
              label.col-12.col-md-2 评论
              textarea.col-12.col-md-10.form-control(rows="5", name="comment")
            .form-group.row
              .col-12.offset-md-8.col-md-4
                button.btn.btn-primary.btn-block(type="submit") 保存评论
  include includes/footer.pug
  script(src="/javascripts/show.js")
